package testsuite_HomePage;

import org.openqa.selenium.WebDriver;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;

public class baseHomepageScript {
	protected static WebDriver driver;
	protected static boolean flagInSuite = false;
	@BeforeTest
	  public void beforeTest() {
		  if (driver == null)
		  {
			  if (flagInSuite)
			  {
				  driver = suiteInitializer.getDriver();
			  }
			  else
			  {
				  testInitializer.startHomepage();
				  driver = testInitializer.getDriver();
			  }
		  }
	  }
	
	@AfterTest
	public void afterTest() {
		  if (!flagInSuite)
			  testFinalizer.closeBrowser();
	}
	
	public static void setSuiteFlag(boolean flag)
	{
		flagInSuite = flag;
	}

}
